home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / strategy / connx-1.001 / connx-1~ / commun.h < prev    next >
C/C++ Source or Header  |  1995-02-11  |  954b  |  49 lines

  1. /*
  2.  * socket package - supports both unix scoket files
  3.  * and TCPIP sockets. Use -DTCPIP when compiling if
  4.  * TCPIP sockets are desired.
  5.  */
  6.  
  7.  
  8. #ifndef COMMUN_H
  9. #define COMMUN_H
  10.  
  11. /* maximum number of connections */
  12. #define MAX_CONN 10
  13.  
  14. /* file to use for UNIX socket files */
  15. #define SOCK_FILE "test1"
  16.  
  17. /* TCPIP port */
  18. #define SOCK_PORT 2112
  19.  
  20.  
  21. /* message sent from client to server */
  22. typedef struct msg
  23. {
  24.   int msg_type;
  25.   int msg_length;
  26.   char *msg;
  27. }
  28.  
  29. gen_msg;
  30.  
  31. /* structure containing connections to server */
  32. typedef struct msg_conn
  33. {
  34.   int number_of_conn;
  35.   int conns[MAX_CONN];
  36. }
  37.  
  38. msg_conn;
  39.  
  40. /* supplied functionss */
  41. int server_open_socket (int *sock);
  42. int server_accept_connection (int sock, msg_conn * conns);
  43. int read_message (int *sock, gen_msg * msg_receive);
  44. int send_message (int *sock, int type, int size, char *msg);
  45. int close_socket (int *sock);
  46. int check_status (int *sock);
  47. int client_open_connection (int *sock, char *name);
  48. #endif
  49.